(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box-m2"));
  // 步骤4：定义配置（指定图表的配置项和数据）


  let option = {
    title:{
      text:"历史球队夺冠次数",
      right:"center"
    },
    legend: {
      top: 'bottom'
    },
    toolbox: {
      show: true,
      feature: {
        mark: { show: true },
        dataView: { show: true, readOnly: false },
        restore: { show: true },
        saveAsImage: { show: true }
      }
    },
    series: [
      {
        name: 'Nightingale Chart',
        type: 'pie',
        radius: [50, 200],
        center: ['50%', '50%'],
        roseType: 'area',
        itemStyle: {
          borderRadius: 8
        },
        data: [
          { value: 17, name: '湖人' },
          { value: 17, name: '凯尔特人' },
          { value: 6, name: '勇士' },
          { value: 6, name: '公牛' },
          { value: 5, name: '马刺' },
          { value: 3, name: '76人' },
          { value: 3, name: '活塞' },
          { value: 3, name: '热火' },
          { value: 2, name: '掘金' },
          { value: 2, name: '火箭' },
          { value: 2, name: '雄鹿' },
          { value: 1, name: '骑士' },
          { value: 1, name: '奇才' },
          { value: 1, name: '雷霆' },
          { value: 1, name: '开拓者' },
          { value: 1, name: '独行侠' },
          { value: 1, name: '猛龙' },
          { value: 1, name: '国王' },
          { value: 1, name: '老鹰' }
        ]
      }
    ]
  };


  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  // window.onresize = () => {
  //     myChart.resize()
  // }

  window.addEventListener("resize", () => {
    myChart.resize();
  });
})();
